import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EntertainmentVO, EntertainmentForm, EntertainmentQuery } from '@/api/nursing/entertainment/types';

/**
 * 查询娱乐活动列表
 * @param query
 * @returns {*}
 */

export const listEntertainment = (query?: EntertainmentQuery): AxiosPromise<EntertainmentVO[]> => {
  return request({
    url: '/nursing/entertainment/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询娱乐活动详细
 * @param id
 */
export const getEntertainment = (id: string | number): AxiosPromise<EntertainmentVO> => {
  return request({
    url: '/nursing/entertainment/' + id,
    method: 'get'
  });
};

/**
 * 新增娱乐活动
 * @param data
 */
export const addEntertainment = (data: EntertainmentForm) => {
  return request({
    url: '/nursing/entertainment',
    method: 'post',
    data: data
  });
};

/**
 * 修改娱乐活动
 * @param data
 */
export const updateEntertainment = (data: EntertainmentForm) => {
  return request({
    url: '/nursing/entertainment',
    method: 'put',
    data: data
  });
};

/**
 * 删除娱乐活动
 * @param id
 */
export const delEntertainment = (id: string | number | Array<string | number>) => {
  return request({
    url: '/nursing/entertainment/' + id,
    method: 'delete'
  });
};
